<?php
	/*
	 * File: subscribe_page_user.php
	 * Last modification: 20.07.2011
	 * Author(s): kivio.wanderley
	 * 
	 */
?>
	
<?php /** UPPER PHP CODE */

	# If checkbox stay checked or not
	$t_use_person 	= gpc_get_bool('chk_use_person', false);
	$t_checked 		= gpc_get_string('t_checked', "");

	if( $t_use_person == true ) {
		$t_checked = "checked";
	} else {
		$t_checked = "";
	}
	
	PRINT '<form action="'. $_SERVER['REQUEST_URI'] .'" method="post">';
	PRINT '<table>';
	PRINT '<tr>';
		PRINT '<td><input type="checkbox" name="chk_use_person" value="true"'. $t_checked .'/>'. lang_get('subscribe_use_person_ask');
			PRINT '<input type="hidden" name="type_option_list" value="'. $t_subscribe_type .'" />';
			PRINT '<input type="hidden" name="t_checked" value="'. $t_checked .'" /></td>';
		PRINT '<td>'; print_submit_button('change_button'); PRINT '</td>';
	PRINT '</tr>';
	PRINT '</table>';
	PRINT '</form>';

?>
	
<form id="sub_form" name="sub_form" action="core/subscribe_inc.php" method="post">

<table>
<tr>
	<td><label><?php echo lang_get('username') . ":"; ?></label></td>
	<td><?php print_text_field("sub_user", "", "", 25, 25, true); ?></td>
</tr>
<tr>
	<td><label><?php echo lang_get('password') . ":"; ?></label></td>
	<td><?php print_text_field("sub_pass", "", "", 25, 25, true); ?></td>
</tr>
<tr>
	<td><label><?php echo lang_get('access_level') . ":"; ?></label></td>
	<td><?php print_access_option_list(VISITOR); ?></td>
	
	<td><input type="hidden" name="subscribe_type" value="<?php echo $t_subscribe_type; ?>" /></td>
	<td><input type="hidden" name="sub_use_person" value="<?php echo ($t_use_person) ? 1 : 0; ?>" /></td>
</tr>
</table><br />

<?php /* User a person from database or not */

	if( $t_use_person == true ) {
		echo '<table>';
		echo '<tr>';
			echo '<td><label>'. lang_get('person_used_to_this_subscribe') . ':</label></td>';
			echo '<td>';
				print_people_option_list();
			echo '</td>';
		echo '</tr>';
		echo '</table>';

		echo '<hr>';
		echo '<input type="hidden" name="type_option_list" value="'. $t_subscribe_type .'">';
			print_submit_button('subscribe_button');
		
	} else {
		require('subscribe_page_people.php');
	}
?>

</form>